<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%> 
 
<div style="margin:20px 0;"></div>
<div class="easyui-panel" >
	<div style="padding:10px 60px 20px 60px">
    <form id="channelgrpForm"  name="channelgrpForm" method="post" >
    	<input type="hidden" name="channel_grp_uuid" value="${infChannelGrp.channel_grp_uuid}"/>
    	<table cellpadding="5" style="width:100%">
    		<tr>
    			<td>通道组别编号:</td>
    			<td><input class="easyui-textbox" type="text" name="channel_grp" data-options="required:true,validType:['checkchngrp']" value="${infChannelGrp.channel_grp }"></input></td>    	     			
    		</tr>
    		<tr>
    			<td>通道组别描述:</td>
    			<td><input class="easyui-textbox" name="descpt" data-options="multiline:true,required:true,validType:['length[0,40]']" style="height:60px" value="${infChannelGrp.descpt }"></input></td>    		     			
    		</tr>   		  		    		 
    	</table>
    
	    <div style="text-align:center;padding:5px">
	    	<a href="javascript:void(0)" class="easyui-linkbutton btn" iconCls="icon-save" id="saveBtn">保存</a>
	    	<a href="javascript:void(0)" class="easyui-linkbutton btn" iconCls="icon-back" iconCls="icon-back" onclick="back()">返回</a>
	    </div>
    </form>
    </div>
</div>
<script>
$(document).ready(function() {
	$.extend($.fn.textbox.defaults.rules, {           
		checkchngrp: {     
            validator: function(value){               
                 var reg = new RegExp("^[a-zA-Z0-9_]{0,10}$"); 
                 return reg.test(value);  
            },     
            message: '只能包括字母数字和_,长度0-10'     
        }        
	});
	
	$("#saveBtn").click(function(){	
		if($("#channelgrpForm").form("validate")){			
			var options ={   
		            url:'<c:url value="/channelgrp/checkChannelGrp.do"/>',   
		            type:'post',                    
		            success:function(data){		            	  
						  if("success"==data){					  
							  //表单提交的方法、比如ajax提交
					    	  $("#channelgrpForm").attr("action","../channelgrp/saveChannelGrp.do?");
					    	  document.getElementById("channelgrpForm").submit();  						  
						  }else{
							  $.jpmessage.info('通道组别编号不能重复!');
						  }
		            }   
		         };
			$("#channelgrpForm").ajaxSubmit(options); 
		}
		
	});
	$("body").keydown(function() {
        if (event.keyCode == "13") {//keyCode=13是回车键
            $('#saveBtn').click();
        }
    });
})
 
	
</script>